#ifndef USEROBJECT_H
#define USEROBJECT_H

#include <QSharedPointer>
#include <qgl.h>

class GLTexture;
class QGLShaderProgram;

class UserObject
{
public:
    UserObject();

    void loadProgram(const QByteArray &vertexShaderSrc, const QByteArray &fragmentShaderSrc);

    //attribute locations
    void setPositionLocation(GLint location) { _positionLocation = location; }
    GLint positionLocation() { return _positionLocation; }
    void setTexCoordLocation(GLint location) { _texCoordLocation = location; }
    GLint texCoordLocation() { return _texCoordLocation; }

    //Sampler locations
    void setBaseMapLocation(GLint location) { _baseMapLocation = location; }
    GLint baseMapLocation() { return _baseMapLocation; }

    void setLightMapLocation(GLint location) { _lightMapLocation = location; }
    GLint lightMapLocation() { return _lightMapLocation; }

    // textures
    void setBaseMapTexture(QSharedPointer<GLTexture> texture) { _baseMapTexture = texture;}
    QSharedPointer<GLTexture> baseMapTexture() { return _baseMapTexture; }

    void setLightMapTexture(QSharedPointer<GLTexture> texture) { _lightMapTexture = texture; }
    QSharedPointer<GLTexture> lightMapTexture() { return _lightMapTexture; }

    void setSamplerLocation(GLint location) { _samplerLocation = location; }
    GLint samplerLocation() { return _samplerLocation; }

    QSharedPointer<QGLShaderProgram> programObject() { return _programObject; }

private:
    GLint _positionLocation;
    GLint _texCoordLocation;
    GLint _baseMapLocation;
    GLint _lightMapLocation;
    GLint _samplerLocation;
    QSharedPointer<GLTexture> _baseMapTexture;
    QSharedPointer<GLTexture> _lightMapTexture;
    QSharedPointer<QGLShaderProgram> _programObject;
};

#endif // USEROBJECT_H
